<?php
class commonTest
{
    public $objectModel;

    public function __construct()
    {
        global $tester;
        $this->objectModel = $tester->loadModel('common');
    }

    /**
     * 检查详情页操作按钮的权限。
     * Check the privilege of the operate action.
     *
     * @param  string     $moduleName
     * @param  object     $data
     * @param  object     $menu
     * @access protected
     * @return array|bool
     */
    public function checkPrivForOperateActionTest(string $moduleName, string $action, array $actionData)
    {
        global $config;
        $object = $this->objectModel->dao->select('*')->from($config->objectTables[$moduleName])->where('id')->eq(1)->fetch();

        $result = $this->objectModel->checkPrivForOperateAction($actionData, $action, $moduleName, $object, 'mainActions');
        return is_array($result) ? !empty($result['url']) : $result;
    }
}
